package com.qf.controller;

import com.qf.bean.Student;
import com.qf.service.StudentService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

/**
 * IntelliJ IDEA -> sss1203
 * 2019/12/3 11:42
 *
 * @author zmyao
 * 别看，我是渣渣。
 */
@Controller
public class StudentController {
    Logger logger = LoggerFactory.getLogger(StudentController.class);
    @Autowired
    private StudentService studentService;
    @RequestMapping("/getStudents")
    public String findStudents(@RequestParam(defaultValue = "1") Integer index, ModelMap map ){
     logger.debug("debug开始");
     logger.info("info开始");
     logger.warn("warn开始");
     logger.error("error开始");
        Page<Student> pageStudents = studentService.findStudents(index, 2);
        map.addAttribute("stupage",pageStudents);
        logger.debug("debug结束");
        logger.info("info结束");
        logger.warn("warn结束");
        logger.error("error结束");
        return  "show";
    }
}
